Release 10.1A: OpenEdge Development:
Progress Dynamics Advanced Development
Creating new browser properties
Now you can start to create the code to support your new feature. This is an extension to the standard browser behavior, so you use the custom files for your changes.
First you must define two new properties that the browser code will need. These are:
BrowsePopupActive— This logical property could be set to disable the pop-up menu so that users can’t change the appearance of a browser.BrowseColumnsMovable— This logical property indicates whether selecting a column header allows the column to be moved (if the property isTRUE) or allows sorting on the column (if the property isFALSE).If you were doing this for a standard ADM2 application that is not using Progress Dynamics, you would define these new properties in a custom include file that is part of the class definition. For the browser this is
src/adm2/custom/brspropcustom.i. You would copy this file to a local directory with the same relative path, and edit it to add your properties, adding the lines shown in bold in the following example to the template code in the main block of the include file:
The
xppreprocessors tell the framework that references to the properties can be made directly, by reading the property values out of the temp-table record where they are stored, which is an optimization over running a function to access them. TheADD-NEW-FIELDstatements add fields to hold the properties to this temp-table, with a data-type ofLOGICAL, no extent, no specific format, and an initial value ofYESandNO,respectively.When you recompile the dynamic browser procedure later, these two custom properties would be added to its definition.
However, as explained elsewhere, Progress Dynamics does not use these property include files, neither the standard ones for SmartObject classes nor the custom ones for extended classes. All attributes are defined in the Repository, and it is here that the Progress Dynamics run-time engine looks to assemble the list of all attributes for an object.
For this reason, you do not use the custom property include file to define extended properties for a class. Instead, you simply define them in the Repository. To do this, you must define the attributes and then associate them with the dynamic browser.
![]()
To define the attributes:
- Choose Attributes
Attribute Control from the Development menu.
- Press Add to define a new attribute in the Attribute Maintenance window, as shown:
![]()
- Define each of the two new attributes in turn, as shown in the previous window.
- Put them in the Browser Attribute Group, and give them a Data Type of Logical.
- Leave the Constant Level at its default value of Instance Level, which means that the attribute values can be defined for a browser instance. None of the toggle boxes apply.
- Leave the Override Type at its default value of None.
- Leave the Lookup Type at its default value of Free Text. In fact, the dynamic property sheet will recognize the data type of
Logicaland automatically presentTRUEandFALSEand the two valid choices for a user setting the property values for an object.Note that the object types list in this window is not enabled for input. This displays the object types the attribute has been added to, but is not directly updateable. After you complete the next step of adding the attributes to the
DynBrowclass, then you can return to this window and verify that theDynBrowclass is shown as the object type for the attributes.- Save each of the two new attributes in turn.
When you return to the Attribute Control browse, press Refresh to see the two new browser attributes along with all the standard ones, as shown:
![]()
Although you have put the new attributes into the browser group, this is only an informal grouping. Next, you must follow these steps to add them explicitly to the
DynBrowclass for the dynamic browser so that they are added to the object attributes at run time.- Go into the Object Type Control from the Progress Dynamics Development menu, as shown:
![]()
- Here you must expand the Base node down through AppServer, Visual, Container, DataVisual, and browser to locate the DynBrow class. As noted elsewhere, the hierarchy of this object type TreeView does not fully represent the hierarchy of classes for every object type, as some classes (such as AppServer) are only used optionally or only used by a subset of the objects at that level.
- Expand the DynBrow node and then right-click on the Attributes node to see the pop-up menu with the Add Attribute Value option. Select that option, as shown:
![]()
- In the Attribute Value Maintenance frame to the right, select the browser Attribute Group and the BrowsePopupActive Attribute Label, as shown:
![]()
- Because this is a Logical attribute its value is represented as a toggle box. Check the Attribute Value toggle box on to set the initial value of the attribute to TRUE.
- Save this and then press the Add button to add a second reference to associate the BrowseColumnsMovable attribute with the DynBrow class.
Now your two new attributes will be added to each new dynamic browser as it is created at run time. You can verify this by clearing the Repository cache, opening a dynamic browser, and looking at its properties in the dynamic property sheet, as shown:
![]()
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |